let rec exist x = function
[] -> false 
  | e::l -> if e=x then true else exist x l;;

let rec add_list x = function 
[] -> [x]
  | e::l -> if x>e then add_list x l else x::e::l;;

let rec remove_list x = function
[] -> failwith "element non present"
  | e::l -> if x>e then remove_list x l else e::x::l;;

let rec map f = function
[] -> []
  | e::l -> f e :: (map f l);;

let rec iter f = function
[] -> []
  | e::l -> (f) e :: (iter f l);;

let rec for_all p = function
[] -> true
  | e::l -> if p e then for_all p l else false;;

let upper_case x = if int_of_char x >= 96&&int_of_char x <= 123 then char_of_int (int_of_char x - 32) else x ;;

let lower_case x = if int_of_char x >= 65&&int_of_char x <= 90 then char_of_int (int_of_char x + 32) else x ;;

let string_of_char x = String.make 1 x;;

let string_apply f str = 
let longueur = (String.length str) - 1 in
let rec parse str i str2 = match i with
   i when i <= longueur  -> (string_of_char ( f str.[i])^str2 )^(parse str (i+1) str2)
  |longueur -> str2 in
 parse str 0 "";;

let string_uppercase str = string_apply (upper_case) str;;

let string_lowercase str = string_apply (lower_case) str;;












